package com.gz.qqserveer;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;

public class MangeServerConnectClientThread {
    //线程数组
    static private HashMap<String,ServerConnectClientThread>hashMap=new HashMap<>();

    public static void addServerConnectClientThread(String userId,ServerConnectClientThread s){
        hashMap.put(userId,s);
    }
    public static void removeServerConnectClientThread(String userId){
        hashMap.remove(userId);
    }

    public static HashMap<String,ServerConnectClientThread> getHashMap(){
        return hashMap;
    }
    public static ServerConnectClientThread getServerConnectClientThread(String userId){
        return hashMap.get(userId);
    }

    public static String getOnlineUser(){

        Iterator iterator = hashMap.keySet().iterator();
        String onlineUser="";
        while (iterator.hasNext()) {
            onlineUser +=  iterator.next().toString()+" ";
            //注意，这里只打印了key值，没有打印hashmap.get(key)
        }
        return onlineUser;

    }
}
